package com.fenghongzhang.lib_core.base

import androidx.appcompat.widget.Toolbar
import androidx.databinding.ViewDataBinding
import com.fenghongzhang.lib_core.R
import com.gyf.immersionbar.ktx.immersionBar


/**
 *@author Wcj
 *@description
 *@date 2022/6/23 9:12
 */
abstract class BaseToolbarActivity<VM : BaseViewModel, VDB : ViewDataBinding> :
    BaseActivity<VM, VDB>() {

    //appbar
    protected lateinit var mToolbar: Toolbar
    //   protected lateinit var mAppBarLayout: AppBarLayout


    override fun initView() {
        initToolbar()
    }

    private fun initToolbar() {
        mToolbar = mBinding.root.findViewById(R.id.toolbar)
//        mAppBarLayout = findViewById(R.id.appbar)
        initToolbar(mToolbar)
        mToolbar.setNavigationOnClickListener { _ -> onBackPressed() }
//        if (null != mAppBarLayout && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
//            View.inflate(this, R.layout.line_dark, mAppBarLayout)
//        }

    }

    override fun initStatusBar() {
        immersionBar {
            this.titleBar(mToolbar)
            this.statusBarDarkFont(true)
        }
    }


    protected open fun initToolbar(toolbar: Toolbar) {

    }


}